/**
 * Parse profile.
 *
 * @param {object|string} json
 * @return {object}
 * @access public
 */

exports.parse = function ([json]) {
  if (json == null) {
    return null;
  }

  if (typeof json == 'string') {
    json = JSON.parse(json);
  }

  const profile = {};
  profile.id = json.LillyID;
  profile.gender = json.Gender;
  profile.email = json.Email;
  if (json.Email) {
    profile.emails = [{ value: json.Email }];
  }
  profile.title = json.title;
  profile.baseLocation = json.BaseLocation;
  profile.chineseName = json.ChineseName;

  profile.SFTitle = json.SFTitle;
  profile.STTS_IND = json.STTS_IND;

  profile.globalID = json.GlobalID;
  profile.lillyID = json.LillyID;
  profile.isSupervisor = json.IsSupervisor;
  profile.managerID = json.ManagerID;
  profile.managerName = json.ManagerName;

  profile.company = json.Company;
  profile.contractorGroup = json.Contractorgroup;
  profile.department = json.Department;
  profile.subDepartment = json.SubDepartment;

  profile.createdAt = json.CRT_DT;
  profile.createdBy = json.CRT_USR;
  profile.updatedAt = json.UP_DT;
  profile.updateby = json.UP_USR;

  return profile;
};
